package com.holy.sh.couviewholy.bser;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;

/**
 * Holy Email :victorhhl@163.com
 * Create by Holy on 2019/8/9
 * Description :
 */
public class FirstBezierView extends View {
    private Paint mPaint;
    public FirstBezierView(Context context) {
        super(context);
        initOP();
    }

    public FirstBezierView(Context context,  AttributeSet attrs) {
        super(context, attrs);
        initOP();
    }

    public FirstBezierView(Context context,  AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initOP();
    }

   private void  initOP(){
       mPaint = new Paint();
       mPaint.setColor(Color.BLACK);
       mPaint.setStyle(Paint.Style.STROKE);
       mPaint.setStrokeWidth(2);
       mPaint.setAntiAlias(true);
      // mPaint.setStrokeMiter(90);//设置画笔倾斜度
       //mPaint.setPathEffect();//设置路径样式 CopmosePathEffect-》》合并路径类型用的
       // CornerPathEffect，DashPathEffect，DiscreteOathEffect，pathDashPathEffect,SumpathEffect
       //mPaint.setStrokeCap(); Cap.ROUND`SQUARE`BUTT
       //mPaint.setStrokeJoin(Paint.Join.BEVEL); //设置路径转角样式 MITER·ROUND·BEVEL
       //mPaint.setDither(true);//抗抖动，颜色丰富无法显示，过度显示马赛克相邻像素中间插入过渡值

       //Paint 字体相关
       //mPaint.setTextSize();
       mPaint.setFakeBoldText(false);//加粗
       mPaint.setStrikeThruText(false);//删除线
       mPaint.setUnderlineText(false);//下划线
       //mPaint.setTextAlign(false);//开始绘图点位置？
       //mPaint.setTextScaleX();//设置水平拉伸
       //mPaint.setTextSkewX();//设置水平斜度
       //mPaint.setTypeface();设置字体样式


   }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        Path path = new Path();

        path.moveTo(100,300);

        path.quadTo(200,200,300,300);
        path.quadTo(400,400,500,300);

        canvas.drawPath(path,mPaint);
    }
}
